package com.woniuxy.controller;

import com.woniuxy.entity.Mail;
import com.woniuxy.service.FanoutService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: 马宇航
 * @Description: TODO
 * @DateTime: 22/10/20/0020 10:37
 * @Component: 成都蜗牛学苑
 **/
@Controller
public class FanoutController {
    @Autowired
    FanoutService fanoutService;

    @PostMapping("fanout")
    @ResponseBody
    public void produce(@ModelAttribute("mail") Mail mail){
        fanoutService.sendEmail("fanoutExchange",mail);
    }
}